package com.blacktry.service.impl;

import com.blacktry.entity.model.AdminRole;
import com.blacktry.entity.model.Role;
import com.blacktry.entity.model.vueVO.Option;
import com.blacktry.mapper.RoleMapper;
import com.blacktry.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author blackTry
 * @since 2021-06-25
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Override
    public Integer addRole(Role role) {
        return this.baseMapper.insert(role);
    }

    @Override
    public Integer removeRolesByIds(List<Integer> ids) {
        return this.baseMapper.deleteBatchIds(ids);
    }

    @Override
    public Integer updateRole(Role role) {
        return this.baseMapper.updateById(role);
    }

    @Override
    public Role getOneById(Integer id) {
        return this.baseMapper.selectById(id);
    }

    @Override
    public List<Role> getRoles(Integer id) {
        return this.baseMapper.getRoles(id);
    }

    @Override
    public List<AdminRole> rolesById(Integer id) {
        return this.baseMapper.rolesById(id);
    }

    @Override
    public String[] getRolesStringArr() {
        return this.baseMapper.getRolesStringArr();
    }

    @Override
    public List<Option> selectAllRoleOptions() {
        return this.baseMapper.selectAllRoleOptions();
    }

}
